<template>
  <div class="">
    <div class="tabs-body">
      <div class="index_main">
        <div class="phone_box">
          <div class="header_img">
            <img src="@/static/douyin_header.png" alt />
            <div class="tixing"></div>
          </div>
          <div class="ph_main">
            <div class="all_play" @click="addBanner">
              <div class="all_play_banner_null" v-if="bannerList.length == 0">点击添加轮播图</div>
              <div class="all_play_banner" v-if="bannerList.length != 0">
                <el-carousel height="190px" indicator-position="outside" :interval="5000">
                  <el-carousel-item v-for="(item, index) in bannerList" :key="index + 'b'">
                    <img class="banner_img" :src="item" alt />
                  </el-carousel-item>
                </el-carousel>
              </div>
            </div>
            <div class="goods_box">
              <div class="statusBox">
                <div class="heaTable">
                  <div class="left">推荐店铺</div>
                  <div class="right">
                    <el-button type="primary" icon="el-icon-edit" circle @click="addClass"></el-button>
                  </div>
                </div>
              </div>
              <div class="baoxiang">
                <div class="chestList">
                  <div class="property_box" v-for="(item, index) in dataInfo.anchorList" :key="index + 'p'">
                    <img class="property_box_img" :src="item.avatar" alt="">
                    <div class="property_box_name">{{ item.nickName }}</div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 轮播图背景 -->
    <banner-diglog v-if="bannerDiglog" :visible.sync="bannerDiglog" @success="_handleSuccess" />
    <!-- 推荐主播 -->
    <AddAnchor v-if="classDiglog" :visible.sync="classDiglog" @success="_handleSuccess" />
  </div>
</template>
<script>
import {
  indexData,
} from "@/api/incentiveManagement/integralTool";
import bannerDiglog from "./integralTool/bannerDiglog";
import AddAnchor from "./integralTool/addAnchor.vue";

export default {
  name: "shopDetail",
  components: {
    bannerDiglog,
    AddAnchor
  },
  props: {},
  data() {
    return {
      bannerDiglog: false,
      classDiglog: false,
      dataInfo:{},//首页数据
      bannerList: [], //轮播图数组
    };
  },
  watch: {},
  created() {
    this.getIndexData()
  },
  mounted() { },
  methods: {
    //获取首页首页
    getIndexData() {
      indexData().then((res) => {
        this.dataInfo = res.result
        if(res.result.imgUrl!=''){
          this.bannerList = [res.result.imgUrl]
        }
      });
    },
    //添加轮播图
    addBanner() {
      this.bannerDiglog = true;
    },
    //编辑分类
    addClass() {
      this.classDiglog = true
    },
    _handleSuccess() {
      this.getIndexData()
    },
  },
};
</script>
<style lang="scss" scoped>
.tabs-body {
  background-color: #fff;
  padding: 20px;
}
.phone_box {
  width: 395px;
  min-height: 1000px;
  border-radius: 30px;
  border: 10px solid #333;
  margin: 40px 200px 0 100px;
  background: #f5f8fe;
  box-sizing: border-box;
  overflow: hidden;
}

.tixing {
  position: absolute;
  top: 0;
  left: 116px;
  width: 145px;
  height: 0;
  border-radius: 2px;
  border-top: 20px solid #333;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
}

.header_img {
  width: 100%;
  position: relative;

  img {
    width: 100%;
    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
  }
}

.turntable_bj {
  width: 100%;
}

.ph_main {
  // padding: 0px 0 10px;
  background: #f2fbff;
}

.all_play {
  width: 100%;
  height: 210px;
  margin: 0 auto;
  position: relative;
  cursor: pointer;

  .all_play_nav {
    width: 100%;
    display: flex;
    align-items: center;
    overflow-x: hidden;
    white-space: nowrap;
    position: absolute;
    top: 46px;
    padding: 0 10px;
    box-sizing: border-box;

    .all_play_nav_box {
      height: 20px;
      border-radius: 100px;
      background: #ffffff;
      color: #333333;
      font-size: 12px;
      line-height: 20px;
      padding: 0 10px;
      margin-right: 20px;
    }
  }

  .all_play_banner_null {
    background-color: #eee;
    width: 100%;
    height: 100%;
    color: red;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .all_play_banner {
    // padding: 10px 10px 0;
    position: relative;
    border-radius: 16px;

    .all_play_banner_title {
      color: #FFFFFF;
      font-size: 15px;
      position: absolute;
      top: 8px;
    }

    .banner_img {
      width: 100%;
      height: 100%;
    }

    .all_play_banner_status {
      width: 52px;
      height: 22px;
      background-color: rgba(0, 0, 0, 0.6);
      color: #ffffff;
      text-align: center;
      line-height: 22px;
      font-size: 12px;
      border-radius: 100px;
      position: absolute;
      top: 20px;
      left: 14px;
      z-index: 2;
    }
  }
}

.nav_box {
  width: 100%;
  height: 120px;
  padding: 0 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;

  .kong_nav {
    width: 100%;
    display: flex;
    justify-content: space-between;
    position: relative;

    .list {
      width: 80px;
      height: 80px;
      border: 1px solid #ccc;
      border-radius: 4px;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 50px;
      color: #ccc;
    }
  }

  .kong_nav:hover {
    .status_edit {
      display: block;
    }
  }

  .navList {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;

    .list {
      display: flex;
      flex: 1;
      flex-direction: column;
      justify-content: space-between;
      align-items: center;

      img {
        width: 52px;
        height: 52px;
      }

      .txt {
        margin-top: 8px;
        font-size: 12px;
        color: #333;
      }
    }
  }

  .navList:hover {
    .status_edit {
      display: block;
    }
  }
}

.status_edit {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 9;
  display: none;
  background: rgba(0, 0, 0, 0.4);

  .editBox {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
}

.goods_box {
  // background: #FFF7EF;
  border-radius: 20px 20px 0 0;

  .statusBox {
    width: 100%;
    height: 58px;
    position: relative;

    .heaTable {
      display: flex;
      justify-content: space-between;
      padding: 0 30px;

      .left {
        height: 60px;
        line-height: 60px;
      }

      .right {
        height: 60px;
        line-height: 60px;
      }
    }

    img {
      width: 100%;
      height: 100%;
    }
  }

  .statusBox:hover {
    .status_edit {
      display: block;
    }
  }
}

.baoxiang {
  .chestList {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .property_box {
    background: url("../../../../static/anchor_bj.png") no-repeat;
    background-size: 100% 100%;
    background-color: #FFF6EC;
    width: 90%;
    height: 70px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    padding: 0 13px;
    border-radius: 10px;
  }

  .property_box_img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
  }

  .property_box_name {
    font-size: 14px;
    color: #333;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
    margin-left: 10px;
  }
}

/* 资产列表star */
.property {
  padding: 11px 15px 0;
}
</style>